package org.example.pojo2;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Component;

import javax.annotation.Resource;

//将这个类 注入给ioc
@Component // 默认id是类名小写
//在@Component 注解下 有三个衍生注解
//@Controller 作用在控制层对象
//@Service  作用在服务层对象
//@Repository  作用在持久层对象
@Data
@AllArgsConstructor
@NoArgsConstructor
// 不加@Scope注解默认是单例模式即@Scope("singleton")
@Scope("prototype") // 深拷贝

public class Person {
    @Value("哈基峰")
    private String name;
    @Autowired
    //@Resource
    private Dept dept;
}
